//
//  EmoticonViewCell.m
//  Emoticon
//
//  Created by 袁量 on 2017/8/13.
//  Copyright © 2017年 袁量. All rights reserved.
//

#import "EmoticonViewCell.h"
@interface EmoticonViewCell()
@property (nonatomic, strong) UIButton *emoticonBtn;
@end
@implementation EmoticonViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI{
    [self.contentView addSubview:self.emoticonBtn];
    self.emoticonBtn.frame = self.contentView.bounds;
    self.emoticonBtn.userInteractionEnabled = false;
    self.emoticonBtn.titleLabel.font = [UIFont systemFontOfSize:32.0f];
}
- (UIButton *)emoticonBtn{
    if (!_emoticonBtn) {
        _emoticonBtn = [[UIButton alloc] init];
    }
    return _emoticonBtn;
}
- (void)setEmoticon:(Emoticon *)emoticon{
    _emoticon = emoticon;
    
    [self.emoticonBtn setImage:[UIImage imageWithContentsOfFile:emoticon.pngPath] forState:UIControlStateNormal];
    [self.emoticonBtn setTitle:emoticon.emojiCode forState:UIControlStateNormal];
    if (emoticon.isRemove) {
        [self.emoticonBtn setImage:[UIImage imageNamed:@"compose_emotion_delete"] forState:UIControlStateNormal];
    }
}
@end
